package com.epam.rentcar.transferobjects;

public class Car {

	private int id;
	private String manufacturer;
	private String model;
	private String number;

	public Car(int id, String manufacturer, String model, String number){
		this.id = id;
		this.manufacturer = manufacturer;
		this.model = model;
		this.number = number;
	}

	public Car(){
	}

	public int getID() {
		return id;
	}
	
	public String getManufacturer() {
		return manufacturer;
	}

	public String getModel() {
		return model;
	}

	public String getNumber() {
		return number;
	}

	@Override
	public String toString() {
		return "" + id + " " + manufacturer + " " + model + " " + number;
	}

	@Override
	public int hashCode() {
		return number.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj instanceof Car) {		
			Car enotherCar = (Car)obj;
			if(manufacturer != enotherCar.getManufacturer() || model != enotherCar.getModel() || number != enotherCar.getNumber()){
				return false;
			}
			return true;
		}
		return false;
	}


}
